#
# Copyright (C) 2023
#
# Brick Yang <printfxxx@163.com>
#
# This program is free software. You can redistribute it and/or
# modify it as you like.
#

sb_core_files = files('Kbuild', 'cmd.c', 'cmd.h', 'compat.c', 'compat.h', 'main.c', 'mtrace.c',
		      'netdev.c', 'netdev.h', 'proto.c', 'ring.h', 'time.c', 'time.h', 'worker.c',
		      'worker.h')

sb_core_kenvs = sb_kenvs
sb_core_kenvs.set('KBUILD_EXTRA_SYMBOLS', meson.current_build_dir() + '/Module.symvers')

sb_core_kmod = custom_target('sb_core_kmod', output: ['simplebits.ko', 'Module.symvers'], command: kbuild_cmd,
			     env: sb_kenvs, input: sb_core_files, build_always_stale: true, build_by_default: true)

meson.add_install_script(kinst_cmd.format(meson.current_build_dir()).split())
